<html>
<head>
    <title></title>

    <!--<script src="https://rawgit.com/zeromq/JSMQ/master/JSMQ.js"></script>-->
    <script src="https://rawgit.com/somdoron/JSMQ/master/JSMQ.js"></script>
    <!--<script src="C:\git\JSMQ\JSMQ.js"></script>-->

    <script>
        var dealer = new JSMQ.Dealer();
        dealer.connect("ws://localhost:8000");

        // we must wait for the dealer to be connected before we can send messages, any messages we are trying to send
        // while the dealer is not connected will be dropped
        dealer.sendReady = function () {
            document.getElementById("sendButton").disabled = "";
        };

        dealer.onMessage = function (message) {
            // the response from the server
            console.log(message.popString());
        };

        function send() {
            var message = new JSMQ.Message();
            message.addString("extra frame");
            message.addString(document.getElementById("messageTextBox").value);
            dealer.send(message);
        }
    </script>
</head>
<body>
    <label>Message:</label><input id="messageTextBox" value="" />
    <button id="sendButton" disabled="disabled" onclick="javascript:send();">
        Send
    </button>
</body>
</html>
